public class MainSink extends Sink {
public MainSink(Sink next) { this.next = next; }
public Stack<Choicepoint> fishFor(String name, int arity, Compound term, int choice, Prolog prolog, Unifier unifier, int cutIndex, Stack<Conjunct> continuation, Stack<Choicepoint> choicepoints) {
Choicepoint choicepoint;
int height = choicepoints.height;
if(arity == 0 && name.equals("main")) {
switch(choice) {
case 0: {
Compound t0 = new Compound("main");
Compound t3 = new Compound("63");
Compound t5 = new Compound("45");
Compound t7 = new Compound("32");
Compound t8 = new Compound("[]");
Compound t6 = new Compound(".", t7, t8);
Compound t4 = new Compound(".", t5, t6);
Compound t2 = new Compound(".", t3, t4);
Compound t1 = new Compound("write_string", t2);
Variable t10 = new Variable("V0");
Compound t9 = new Compound("read_line", t10);
Variable t12 = new Variable("V1");
Compound t11 = new Compound("parse_string", t10, t12);
Variable t14 = new Variable("V2");
Variable t15 = new Variable("V3");
Compound t13 = new Compound("ir2pl", t12, t14, t15);
Compound t16 = new Compound("closed_list", t15);
Compound t17 = new Compound("!");
Compound t20 = new Compound("execute_term", t14, t15);
Compound t21 = new Compound("true");
Compound t19 = new Compound("->", t20, t21);
Compound t25 = new Compound("110");
Compound t27 = new Compound("111");
Compound t29 = new Compound("46");
Compound t30 = new Compound("[]");
Compound t28 = new Compound(".", t29, t30);
Compound t26 = new Compound(".", t27, t28);
Compound t24 = new Compound(".", t25, t26);
Compound t23 = new Compound("write_string", t24);
Compound t31 = new Compound("nl");
Compound t22 = new Compound(",", t23, t31);
Compound t18 = new Compound(";", t19, t22);
Compound t32 = new Compound("main");
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t1, t9, t11, t13, t16, t17, t18, t32);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 2 && name.equals("execute_term")) {
switch(choice) {
case 0: {
Variable t1 = new Variable("V0");
Variable t2 = new Variable("V1");
Compound t0 = new Compound("execute_term", t1, t2);
Compound t3 = new Compound("call", t1);
Compound t4 = new Compound("display_variables", t2);
Variable t6 = new Variable("V2");
Compound t5 = new Compound("read_character", t6);
Compound t7 = new Compound("write_character", t6);
Compound t8 = new Compound("nl");
Compound t10 = new Compound("59");
Compound t9 = new Compound("\\=", t6, t10);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t3, t4, t5, t7, t8, t9);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
if(arity == 1 && name.equals("display_variables")) {
switch(choice) {
case 0: {
Compound t1 = new Compound("[]");
Compound t0 = new Compound("display_variables", t1);
if(unifier.unify(t0,term)) {
choicepoint = new Choicepoint(continuation,height);
choicepoint.bindings = unifier.bound;
return new Stack<Choicepoint>(choicepoint,choicepoints);
}
break;
}
case 1: {
Variable t3 = new Variable("V0");
Variable t4 = new Variable("V1");
Compound t2 = new Compound("-->", t3, t4);
Variable t5 = new Variable("V2");
Compound t1 = new Compound(".", t2, t5);
Compound t0 = new Compound("display_variables", t1);
Compound t6 = new Compound("nl");
Compound t8 = new Compound("=", t3, t4);
Compound t7 = new Compound("write", t8);
Compound t9 = new Compound("display_variables", t5);
if(unifier.unify(t0,term)) {
choicepoints.head.query = choicepoints.head.query.tail;
choicepoints.head.addQuerents(height-1, t6, t7, t9);
choicepoints.head.addBindings(unifier.bound);
return choicepoints;
}
break;
}
default: choicepoints.head.dead = true;
}
return choicepoints;
}
return next.fishFor(name,arity,term,choice,prolog,unifier,cutIndex,continuation,choicepoints);
}
}
